
package com.cafe.case4;

import java.util.concurrent.Callable;

public class CafeCallable implements Callable {
    private int num;

    public CafeCallable(int num) {
        this.num = num;
    }


    @Override
    public String call() throws Exception {
        int total = 0;
        for (int i = 0; i < num; i++) {
            total += i;
        }
        return Thread.currentThread() + "线程计算出了1-" + num + "的和是：" + total;
    }
}
